package com.ruoyi.hr.service.impl.contractmanage;

import com.ruoyi.common.annotation.DataSource;
import com.ruoyi.common.enums.DataSourceType;
import com.ruoyi.framework.util.ShiroUtils;
import com.ruoyi.hr.domain.Authority;
import com.ruoyi.hr.mapper.ProcedureMapper;
import com.ruoyi.hr.mapper.SkyMsgAlarmMapper;
import com.ruoyi.hr.mapper.contractmanage.NewSignMapper;
import com.ruoyi.hr.service.contractmanage.NewSignService;
import com.ruoyi.hr.util.BaseResult;
import com.ruoyi.hr.util.ResultEnum;
import com.ruoyi.hr.util.utils;
import com.ruoyi.system.domain.SysUser;
import com.ruoyi.system.mapper.SysUserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;


@Service
public class NewSignServiceImpl implements NewSignService {

    @Autowired
    NewSignMapper newSignMapper;

    @Autowired
    SysUserMapper sysUserMapper;

    @Autowired
    SkyMsgAlarmMapper skyMsgAlarmMapper;

    @Autowired
    ProcedureMapper procedureMapper;

    @DataSource(value = DataSourceType.SLAVE)
    @Override
    public List<Map<String, Object>> findDataList(Map map, Authority authority) {
        return newSignMapper.findDataList(map, authority);
    }

    @DataSource(value = DataSourceType.SLAVE)
    @Override
    public Map<String, Object> findDataById(String id) {
        return newSignMapper.findDataById(id);
    }

    @DataSource(value = DataSourceType.SLAVE)
    @Override
    public List<Map<String, Object>> findComp() {
        return newSignMapper.findComp();
    }

    @DataSource(value = DataSourceType.SLAVE)
    @Override
    public int editData(Map map) {
        return newSignMapper.editData(map);
    }

    @DataSource(value = DataSourceType.SLAVE)
    @Override
    public int remove(String ids) {
        String[] idSplit = ids.split(",");
        int num = 0;
        for (String id : idSplit) {
            num += newSignMapper.remove(id);
        }
        return num;
    }


}
